#!/bin/bash
CNT=1
while true
do 
echo "Check Count: $CNT"
if [ "$CNT" -ge 10 ]; then
   echo "Delete database ..."
   rm -fv my-db
   CNT=0
fi
echo "check CN sen ..."
./get_price.py -s 'http://www.amazon.cn/s/ref=sr_nr_p_n_feature_browse-b_1?fst=as%3Aoff&rh=n%3A2016116051%2Cn%3A%212016117051%2Cn%3A760233051%2Cn%3A1397649071%2Cn%3A760240051%2Cp_89%3ASennheiser+%E6%A3%AE%E6%B5%B7%E5%A1%9E%E5%B0%94'
echo "check CN all ..."
./get_price.py -s 'http://www.amazon.cn/s/ref=sr_nr_p_n_feature_browse-b_1?fst=as%3Aoff&rh=n%3A2016116051%2Cn%3A%212016117051%2Cn%3A760233051%2Cn%3A1397649071%2Cn%3A760240051%2Cp_n_feature_browse-bin%3A2127514051'
echo "check CN akg ..."
./get_price.py -s 'http://www.amazon.cn/s/ref=sr_nr_p_n_feature_browse-b_0?fst=as%3Aoff&rh=n%3A2016116051%2Cn%3A%212016117051%2Cn%3A760233051%2Cn%3A1397649071%2Cn%3A760240051%2Cp_89%3AAKG+%E7%88%B1%E7%A7%91%E6%8A%80%2Cp_n_feature_browse-bin%3A2127514051'
echo "check CN beyer ..."
./get_price.py -s 'http://www.amazon.cn/s/ref=sr_nr_p_89_2?fst=as%3Aoff&rh=n%3A2016116051%2Cn%3A%212016117051%2Cn%3A760233051%2Cn%3A1397649071%2Cn%3A760240051%2Cp_n_feature_browse-bin%3A2127514051%2Cp_89%3ABeyerdynamic+%E6%8B%9C%E4%BA%9A%E5%8A%A8%E5%8A%9B'
echo "check CN beats ..."
./get_price.py -s 'http://www.amazon.cn/s/ref=sr_nr_p_89_1?fst=as%3Aoff&rh=n%3A2016116051%2Cn%3A%212016117051%2Cn%3A760233051%2Cn%3A1397649071%2Cn%3A760240051%2Cp_n_feature_browse-bin%3A2127514051%2Cp_89%3ABeats'
echo "check CN ATH ..."
./get_price.py -s 'http://www.amazon.cn/gp/search/ref=sr_nr_p_n_feature_browse-b_1?fst=as%3Aoff&rh=n%3A2016116051%2Cn%3A%212016117051%2Cn%3A760233051%2Cn%3A1397649071%2Cn%3A760240051%2Cp_89%3AAudio+Technica+%E9%93%81%E4%B8%89%E8%A7%92%2Cp_n_feature_browse-bin%3A2127514051'
echo "check CN Denon ..."
./get_price.py -s 'http://www.amazon.cn/s/ref=sr_nr_p_89_6?fst=as%3Aoff&rh=n%3A2016116051%2Cn%3A%212016117051%2Cn%3A760233051%2Cn%3A1397649071%2Cn%3A760240051%2Cp_n_feature_browse-bin%3A2127514051%2Cp_89%3ADenon+%E5%A4%A9%E9%BE%99'
echo "check CN yamaha ..."
./get_price.py -s 'http://www.amazon.cn/s/ref=sr_in_-2_p_89_44?fst=as%3Aoff&rh=n%3A2016116051%2Cn%3A%212016117051%2Cn%3A760233051%2Cn%3A1397649071%2Cn%3A760240051%2Cp_n_feature_browse-bin%3A2127514051%2Cp_89%3AYamaha+%E9%9B%85%E9%A9%AC%E5%93%88'

# sen
echo "check US sen ..."
./get_price.py  -s 'http://www.amazon.com/s/ref=lp_12097479011_nr_p_89_0?fst=as%3Aoff&rh=n%3A172282%2Cn%3A%21493964%2Cn%3A172541%2Cn%3A12097479011%2Cp_89%3ASennheiser'
# akg
echo "check US akg ..."
./get_price.py  -s 'http://www.amazon.com/s/ref=sr_in_-2_p_89_1?fst=as%3Aoff&rh=n%3A172282%2Cn%3A%21493964%2Cn%3A172541%2Cn%3A12097479011%2Cp_89%3AAKG'
# beyer
echo "check US beyer ..."
./get_price.py  -s 'http://www.amazon.com/s/ref=sr_in_-2_p_89_8?fst=as%3Aoff&rh=n%3A172282%2Cn%3A%21493964%2Cn%3A172541%2Cn%3A12097479011%2Cp_89%3Abeyerdynamic'
# ATH
echo "check US ATH ..."
./get_price.py  -s 'http://www.amazon.com/s/ref=sr_in_-2_p_89_3?fst=as%3Aoff&rh=n%3A172282%2Cn%3A%21493964%2Cn%3A172541%2Cn%3A12097479011%2Cp_89%3AAudio-Technica'
# all
echo "check US all ..."
./get_price.py  -s 'http://www.amazon.com/s/ref=sr_nr_p_89_3?fst=as%3Aoff&rh=n%3A172282%2Cn%3A%21493964%2Cn%3A172541%2Cn%3A12097479011'
echo "check US Denon ..."
./get_price.py  -s 'http://www.amazon.com/s/ref=nb_sb_noss_2?url=node%3D12097479011&field-keywords=denon+AH&rh=n%3A172282%2Cn%3A172541%2Cn%3A12097479011%2Ck%3Adenon+AH'
echo "check US yamaha ..."
./get_price.py  -s 'http://www.amazon.com/s/ref=nb_sb_noss_2?url=node%3D12097479011&field-keywords=yamaha+hph&rh=n%3A12097479011%2Ck%3Ayamaha+hph'

CNT=$(($CNT + 1))
echo "wait 5 minutes ..."
sleep 300
done
